package foundation;

import org.junit.Test;

import java.util.HashMap;

/**
 * Created by gmwang on 2018/10/23
 */
public class TestHashMap {
    @Test
    public void test() throws InterruptedException {
     HashMap<Integer,String> map = new HashMap<Integer,String>(2,0.75f);
        map.put(5, "C");

        new Thread("Thread1") {
            @Override
            public void run() {
                map.put(7, "B");
                System.out.println(map);
            };
        }.start();
        new Thread("Thread2") {
            @Override
            public void run() {
                map.put(3, "A");
                System.out.println(map);
            };
        }.start();
        Thread.sleep(100);
        System.out.println(map.get(11));
    }
}
